<?php include $this->admin_tpl('header'); ?>

<div class="content">
<div class="site"> <?php echo C('site_name')?> <a href="#">联盟商家</a> > 商家分类 </div>
<span class="line_white"></span> 
<script type="text/javascript" src="/template/default/statics/js/area.js"></script>
<script>var ajaxurl = "<?php echo U('Union/getArea') ?>";</script>
<div class="install mt10">
  <dl>
    <dt><a href="<?php echo U('Union/index') ?>">联盟商家列表</a><a href="javascript:void(0)" class="hover">商家分类</a></dt>
    <dd>
      <div class="install mt10">
        <dl>
          <form action="<?php echo U('Union/typeadd') ?>" class="addform" method="post">
            <dd>
              <ul class="web">
                <li> <strong>分类名称：</strong>
                  <input type="text" class="text_input" name="type_name" value="<?php echo $info["type_name"];?>" placeholder='' datatype="*"/>
                  <span class="Validform_checktip ">请填写商家分类 </span> </li>
                 <li style="line-height:24px;"> <strong>栏目图片：</strong> <b style="width:256px;">
                  <input value="<?php echo $info["type_logo"];?>" type="hidden" name="type_logo">
                  <img class="upimg" src="<?php echo IMG_PATH; ?>admin/input_9.png"> 
                  <?php if($info["type_logo"]!=""){?>
                  <span style="padding-left: 0px;"><img src="<?php echo $info["type_logo"];?>" height="43"></span>
                  <?php }?>
                  <span style="padding-left: 0px;"></span> </b><span>栏目图片</span> </li>
                </ul> 
              <div class="input1">
               <?php if(!empty($info)){ ?>
                            <input type="hidden" value="<?php echo $info['id'] ?>" name="id" />
                            <input type="hidden" value="edit" name="opt" />
                    	<?php }else{ ?>
                            <input type="hidden" value="add" name="opt" />
                        <?php }; ?>
                <input type="button" class="button_search "  id="btn_sub" value="提交" />
              </div>
            </dd>
          </form>
        </dl>
      </div>
    </dd>
  </dl>
</div>
<!--编辑器开始-->
<link rel="stylesheet" type="text/css" href="<?php echo CSS_PATH; ?>Editor/themes/default/default.css">
<script type="text/javascript" src="<?php echo JS_PATH; ?>Editor/kindeditor-min.js"></script> 
<script type="text/javascript" src="<?php echo JS_PATH; ?>Editor/lang/zh_CN.js"></script> 
<script>
        $(function() {
        	//编辑器载入
			KindEditor.ready(function(K) {
				//K.create('#content');
				editor = K.editor({
                    uploadJson : '<?php echo U("Admin/Editor/upload?SSID=",'','');?>'+'<?php echo C("SSID");?>',
                	fileManagerJson : '<?php echo U("Admin/Editor/file_manage?parentdir=type_logo/",'','');?>',
                    extraFileUploadParams: {
                         PHPSESSID : '<?php echo session_id() ?>',
                         parentdir : 'type_logo/'
                    },
                    allowFileManager: true
                });
				//给按钮添加click事件
				$('.upimg').live('click', function() {
					var self = $(this);
					editor.loadPlugin('image', function() {
						//图片弹窗的基本参数配置
						editor.plugin.imageDialog({
							imageUrl: self.prev('input').val(), //如果图片路径框内有内容直接赋值于弹出框的图片地址文本框
							//点击弹窗内”确定“按钮所执行的逻辑
							clickFn: function(url, title, width, height, border, align) {
								self.prev("input").val(url);
								self.next("span").html("<img src=" + url + " height=43>");
								editor.hideDialog(); //隐藏弹窗
							}
						});
					});
				});
			});
           
        });
    </script> 
<script>
$(function() {
	var demo = $(".addform").Validform({
		btnSubmit: "#btn_sub",
		btnReset: ".btn_reset",
		tiptype: function(){},
		label: ".label",
		showAllError: false,
		ajaxPost: true,
		callback: function(data) {
			$("#Validform_msg").hide();
			if (data.status == 0) {
				art.dialog({width: 320, time: 5, title: '温馨提示(5秒后关闭)', content: data.info, ok: true});
			}
			if (data.status == 1) {
				window.location.href = data.url;
			}
		}
	});
});
</script>
<?php include $this->admin_tpl('copyright') ?>
